package com.un10.qianduan.contorller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.un10.entity.Proclass;
import com.un10.entity.Product;
import com.un10.entity.User;
import com.un10.service.ProclassService;
import com.un10.service.UserService;

@Controller
public class UserWebContorller {
	 @Autowired
		ProclassService proclassService;
	 @Autowired
	 UserService   userService ;
	  @RequestMapping("/B/Userid")	
	  public String User(Model model, HttpSession session) {
		//用户信息
	   
	    //商品分类
	    List<Proclass> proclass = proclassService.findAllProclass(0, 9999, null);
	    model.addAttribute("proclass", proclass);	
	    // 重定向到主页面的跳转方法
		
		/*
		 * List<User> user = userService.findAllUser(0, 9999, null);
		 * model.addAttribute("user", user);
		 */
		    
	  
	    return "B/User";
	  }
	  @RequestMapping("/B/UserName")
		public String UserName(Model model, @RequestParam("userName") String userName) {
			List<User> user = userService.findAllUserName(userName);
			
			model.addAttribute("user", user);
		
			// 重定向到主页面的跳转方法
			return "B/User";
		}

	  
}
